package com.cssw.fyzb.core.dao.video;

import com.cssw.fyzb.core.model.dodb.CmfVideoHotDef;
import com.cssw.fyzb.core.model.dodb.CmfVideoHotInst;
import com.ydn.dbframe.plugin.activerecord.Page;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author YangYiQun
 */
@Repository
public class VideoHotInstDaoImpl implements VideoHotInstDao {

    @Override
    public CmfVideoHotInst findById(Long hotId) {
        return CmfVideoHotInst.dao.findById(hotId);
    }

    @Override
    public Long save(Long hotId, Integer hotValue, Long videoId, BigDecimal price,
                     Integer hotTime, String hotOprCode, Date startTime, Date endTime) {
        CmfVideoHotInst hotInst = new CmfVideoHotInst();
        hotInst.setHotId(hotId);
        hotInst.setHotValue(hotValue);
        hotInst.setVideoId(videoId);
        hotInst.setPrice(price);
        hotInst.setHotTime(hotTime);
        hotInst.setHotOprCode(hotOprCode);
        hotInst.setStartTime(startTime);
        hotInst.setEndTime(endTime);
        hotInst.setCreateTime(new Date());
        hotInst.save();
        return hotInst.getInstId();
    }
}
